package com.rsk.api.curriculum;


import java.util.List;
import java.util.Map;

import javax.ws.rs.QueryParam;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.dubbo.config.annotation.Reference;
import com.rsk.aop.ParamCheck;
import com.rsk.api.common.ReturnUtils;
import com.rsk.service.curriculum.RskCourseExamineService;
import com.rsk.utils.result.Result;
import com.rsk.utils.result.ResultBuilder;
import com.rsk.utils.result.ResultCode;
import com.rsk.utils.tools.PageUtils;

@RestController
@RequestMapping(value="/rsk/courseExamine")
public class RskCourseExamineApi {
	
	@Reference(interfaceClass = RskCourseExamineService.class, protocol = "dubbo")
	private RskCourseExamineService rskCourseExamineService;
	
	
	//@RequiresPermissions("coursecategory:save")
	@PostMapping(value="/saveRskCourseExamine" )
	public Result<String> saveRskCourseExamine(
			@QueryParam("courseId") @ParamCheck(notNull=true) Long courseId,
			@QueryParam("examineStatus") @ParamCheck(notNull=true) Integer examineStatus,
			@QueryParam("examineRemarks") @ParamCheck(notNull=true) String examineRemarks,
			@RequestHeader("Authorization") String Authorization){
		//数据校验
		//String operatorUser = JwtUtil.getClaim(Authorization, "account");
		Long operatorUser = 123L;
		int i = rskCourseExamineService.saveRskCourseExamine(courseId, examineStatus, examineRemarks, operatorUser);
		return ReturnUtils.returnDataByOne(i);
	}
	
	
	
	//@RequiresPermissions("coursecategory:del")
	@PostMapping(value="/delRskCourseExamine" )
	public Result<String> delRskCourseExamine(@QueryParam("id") @ParamCheck(notNull=true) Long id,
									        @RequestHeader("Authorization") String Authorization){
		//String operatorUser = JwtUtil.getClaim(Authorization, "account");
		Long operatorUser = 123L;
		int i = rskCourseExamineService.delRskCourseExamine(id, operatorUser);
		return ReturnUtils.returnDataByOne(i);
	}
	
	@SuppressWarnings("rawtypes")
	@PostMapping(value="/selectCourseExamine" )
	public Result<List<Map>> selectCourseExamine(
			@QueryParam("courseId") @ParamCheck(notNull=true) Long courseId,
			@RequestHeader("Authorization") String Authorization){
		//String operatorUser = JwtUtil.getClaim(Authorization, "account");
		List<Map> list = rskCourseExamineService.selectRskCourseExamine(courseId);
		return ResultBuilder.success(list, ResultCode.SUCCESS);
	}
	

	@SuppressWarnings("rawtypes")
	@PostMapping(value="/selectCourseCategoryByPage" )
	public Result<PageUtils> selectCourseCategoryByPage(
			@QueryParam("nowPage") @ParamCheck(notNull=true) Integer nowPage,
			@QueryParam("pageSize") @ParamCheck(notNull=true) Integer pageSize,
			@QueryParam("categoryName") String categoryName,
			@RequestHeader("Authorization") String Authorization){
		//String operatorUser = JwtUtil.getClaim(Authorization, "account");
/*		PageUtils page = rskCourseExamineService.s;
		return ResultBuilder.success(page, ResultCode.SUCCESS);*/
		return null;
	}
}
